package good.threadlocalDemo;

public class ThreadDemo{
	private Integer i=1;
	private ThreadDemo() {
	}
	public static ThreadDemo getInstance(){
		System.out.println(Thread.currentThread().getName());
		ThreadLocal<ThreadDemo> tl=new ThreadLocal<ThreadDemo>();
		ThreadDemo td=tl.get();
		if(td==null){
			tl.set(new ThreadDemo());
		}
		return tl.get();
	}
	public Integer getI() {
		return i;
	}
	public void setI(Integer i) {
		this.i = i;
	}


}
